package com.thinkcoder.controller;

import com.thinkcoder.protocol.Result;
import com.thinkcoder.service.SignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SignController {

    @Autowired
    private SignService signService;

    @GetMapping("/gettoken")
    public Result<String> getToken(@RequestParam String userId,@RequestParam String timestamp,@RequestParam String sign){
        String token = this.signService.getToken(userId, timestamp,sign);
        return Result.buildSuccess(token);
    }


    @GetMapping("/getsign")
    public Result<String> getSign(String userId,String timestamp){
        return Result.buildSuccess(this.signService.getSign(userId,timestamp));
    }

}
